<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<%@page isELIgnored="false"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org选择-SJH</title>
</head>
<e:View id="eView" designProperty="width: 1024px; height: 768px">
    <script type="text/javascript">SkinUtil.getSkin();</script>
    <script type="text/javascript">SkinUtil.getModuleSkin();</script>	
	
<div id="Invisual Controls" style="display: none;" style="min-height: 40px; background-color: LemonChiffon;" >
	<e:Dataset id="Dataset_Org" datasetDefinition="DatasetDefinition_sys.dsd" pageSize="-1" loadDataCommand="Command_load">
		<e:Field name="orgId" dataType="string" label="ID" maxLength="32" />
		<e:Field name="orgName" dataType="string" label="NAME" maxLength="200" />
		<e:Field name="parentOrgId" dataType="string" label="PARENT_ID" maxLength="32" />
		<e:Field name="sortNo" dataType="integer" label="SORT_NO" maxLength="4" />
		<e:Field name="remark" dataType="string" label="REMARK" maxLength="200" />
	</e:Dataset>
	
	<e:Command id="Command_load" action="com.longtop.framework.sys.org.web.OrgDropdownAction" method="load" showHintInfoOnSuccess="false">
		<e:DatasetInfo name="info" dataset="Dataset_Org" submitType="none" alwayRefreshClient="true"></e:DatasetInfo>
	</e:Command>

</div>
<body>
<e:Page id="ePage" action="com.longtop.framework.sys.org.web.OrgDropdownAction" style="min-height: 80px; width: 100%; height: 100%;" onAfterLoadPage="ePage_onAfterLoadPage()" onBeforeLoadPage="ePage_onBeforeLoadPage()">
	<table style="width: 100%; height: 100%;" border="0" cellpadding="0" cellspacing="0">
	<tbody>
		<tr>
			<td>
				<e:DataTree dataset="Dataset_Org" id="DataTree_Org" labelField="orgName" valueField="orgId" 
						parentField="parentOrgId" rootContextRelative="true" lazyLoading="true" 
						useDefaultFolderIcon="true" style="width:100%;height:100%" 
						contextMenuItems="expand,collapse" showRoot="false" rootLabel="机构树"
						onDblClickTreeNode="DataTree_Org_onDblClickTreeNode(tree,node)">
				</e:DataTree>
			</td>
		</tr>
	</tbody>
    </table>
</e:Page>
</body>
<script type="text/javascript">
	//init
	function ePage_onBeforeLoadPage(){	
		var showSelect = "${param.showSelect}";
		var excludeParent = "${param.excludeParent}";
		var checkedRelaNode = "${param.checkedRelaNode}";
		if(showSelect == 'true'){
			$J("DataTree_Org").useCheckBox = true;
			if(checkedRelaNode == "false"){//是否关联上下级节点
				$J("DataTree_Org").checkedRelaNode = "false";
			}else {
				$J("DataTree_Org").checkedRelaNode = "true";
			}			
			if(excludeParent == "false"){//是否排除关联上级节点。只关联下级节点。
				$J("DataTree_Org").excludeCheckedParentNode = false;
			}else {
				$J("DataTree_Org").excludeCheckedParentNode = true;
			}
		}
	}	
	function ePage_onAfterLoadPage(){
		var tree = $J("DataTree_Org");
	    if (!tree) {
	        MsgBox.showWarnMsg("机构树还未生成！");
	        return;
	    }
	    /*
	    if (!tree.currentNode) {
	    	tree.setCurrentNode();
		}
	    tree.expandNode();//展开当前节点
	    */
	}
	//双击确定，关闭弹出框
	function DataTree_Org_onDblClickTreeNode(tree,node) {
		//通用 调用此页面
		var dropDown = $J(parent.LookupDropDown_Org);
		if (dropDown != null) {
			dropDown.confirm();
		}
	
		//数据权限调用此页面
		dropDown = $J(parent.LookupDropDown_DataScope);
		if (dropDown != null) {
			dropDown.confirm();
		}
	}
</script>
</e:View>
</html>
